package com.rede.didiok.admin.support;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rede.didiok.admin.service.AdminService;
import com.rede.didiok.common.constant.global.Constants;
import com.rede.didiok.common.dto.community.MomentCommentDto;
import com.rede.didiok.common.feign.CommunityFeignClient;
import com.rede.didiok.common.holder.RequestHolder;
import com.rede.didiok.common.utils.StringUtils;


@Service("momentCommentSupport")
public class MomentCommentSupport {

    @Autowired
    CommunityFeignClient communityFeignClient;
    @Autowired
    AdminService adminService;

    /**
     * 审核评论
     * @param momentCommentDto
     * @return
     */
    public String auditComment(MomentCommentDto momentCommentDto) {
        String nickname = adminService.getNicknameById(RequestHolder.getAdminUid());
        if(StringUtils.isEmpty(nickname)) {
            momentCommentDto.setAuditName(Constants.DEFAULT_STR);
        }else {
            momentCommentDto.setAuditName(nickname);
        }
        return communityFeignClient.auditComment(momentCommentDto);
    }
}